<?php

class model_user_control_panel extends model
{
	
	public function edit($name)
	{

		$user = bone::get_user();
		if($user->guest)
		{
			$this->set_error('登陆超时');
			return false;
		}

		$table = bone::get_table('user');
		$table->load($user->id);
		$table->name = $name;
		$table->save();

		$user->name = $name;

		$session = bone::get_session();
		$session->set('user', $user );

		return true;
	}

	public function reset_password($password)
	{
		$user = bone::get_user();
		if($user->guest)
		{
			$this->set_error('登陆超时');
			return false;
		}

		$table = bone::get_table('user');
		$table->load($user->id);
		$table->password = md5($password);
		$table->save();

		return true;
	}


}
?>